package com.shengdong.water.feature.latlong

import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.hjq.bar.OnTitleBarListener
import com.hjq.bar.TitleBar
import com.hjq.toast.Toaster
import com.shengdong.water.R
import com.shengdong.water.code.base.BaseActivity
import com.shengdong.water.code.config.RouterConfig
import com.shengdong.water.databinding.ActivityLatLongBinding
import dagger.hilt.android.AndroidEntryPoint

@Route(path = RouterConfig.LATLONG_PATH)
@AndroidEntryPoint
class LatLongActivity : BaseActivity<ActivityLatLongBinding>() {
    override fun getLayoutId() = R.layout.activity_lat_long



    override fun setupView() {
        super.setupView()
        setTitle("经纬度")
        setupListener()

    }

    private fun setupListener(){

        binding.btnSure.setOnClickListener {
            if(binding.editLatitude.text.isNullOrEmpty()) {
                Toaster.show("纬度不能为空")
                return@setOnClickListener
            }
            if(binding.editLongitude.text.isNullOrEmpty()){
                Toaster.show("经度不能为空")
            }

            val dataIntent = Intent()
            dataIntent.putExtra("longitude",binding.editLongitude.text.toString() )
            dataIntent.putExtra("latitude",binding.editLatitude.text.toString())
            setResult(RESULT_OK, dataIntent)
            finish()
        }

    }

    override fun handleBackPress() {

    }


}